#kafka_node_1
docker run --restart always -d \
--name kafka_node_1 --network kafka_online \
-e KAFKA_ZOOKEEPER_CONNECT='172.16.50.224:2181,172.16.50.223:2181,172.16.50.225:2181' \
-e KAFKA_LISTENERS='PLAINTEXT://0.0.0.0:9092' \
-e KAFKA_BROKER_ID='1' \
-e KAFKA_ADVERTISED_LISTENERS='PLAINTEXT://172.16.50.224:9092' \
-e KAFKA_LOG_DIRS=/kafka/logs \
-e KAFKA_AUTO_CREATE_TOPICS_ENABLE=true \
-e KAFKA_LOG_RETENTION_HOURS=72 \
-e KAFKA_OFFSETS_COMMIT_REQUIRED_ACKS=1 \
-e KAFKA_NUM_PARTITIONS=3 \
-e KAFKA_DEFAULT_REPLICATION_FACTOR=3 \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=3 \
-e KAFKA_MIN_INSYNC_REPLICAS=2 \
-e KAFKA_UNCLEARN_LEADER_ELECTION_ENABLE=false \
-v /data/lib/kafka:/kafka/logs \
-p 9092:9092  \
docker.io/wurstmeister/kafka

#kafka_node_2
docker run --restart always -d \
--name kafka_node_2 --network kafka_online \
-e KAFKA_ZOOKEEPER_CONNECT='172.16.50.224:2181,172.16.50.223:2181,172.16.50.225:2181' \
-e KAFKA_LISTENERS='PLAINTEXT://0.0.0.0:9092' \
-e KAFKA_BROKER_ID='2' \
-e KAFKA_ADVERTISED_LISTENERS='PLAINTEXT://172.16.50.223:9092' \
-e KAFKA_LOG_DIRS=/kafka/logs \
-e KAFKA_AUTO_CREATE_TOPICS_ENABLE=true \
-e KAFKA_LOG_RETENTION_HOURS=72 \
-e KAFKA_OFFSETS_COMMIT_REQUIRED_ACKS=1 \
-e KAFKA_NUM_PARTITIONS=3 \
-e KAFKA_DEFAULT_REPLICATION_FACTOR=3 \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=3 \
-e KAFKA_MIN_INSYNC_REPLICAS=2 \
-e KAFKA_UNCLEARN_LEADER_ELECTION_ENABLE=false \
-v /data/lib/kafka:/kafka/logs \
-p 9092:9092  \
docker.io/wurstmeister/kafka

#kafka_node_3
docker run --restart always -d \
--name kafka_node_3 --network kafka_online \
-e KAFKA_ZOOKEEPER_CONNECT='172.16.50.224:2181,172.16.50.223:2181,172.16.50.225:2181' \
-e KAFKA_LISTENERS='PLAINTEXT://0.0.0.0:9092' \
-e KAFKA_BROKER_ID='3' \
-e KAFKA_ADVERTISED_LISTENERS='PLAINTEXT://172.16.50.225:9092' \
-e KAFKA_LOG_DIRS=/kafka/logs \
-e KAFKA_AUTO_CREATE_TOPICS_ENABLE=true \
-e KAFKA_LOG_RETENTION_HOURS=72 \
-e KAFKA_OFFSETS_COMMIT_REQUIRED_ACKS=1 \
-e KAFKA_NUM_PARTITIONS=3 \
-e KAFKA_DEFAULT_REPLICATION_FACTOR=3 \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=3 \
-e KAFKA_MIN_INSYNC_REPLICAS=2 \
-e KAFKA_UNCLEARN_LEADER_ELECTION_ENABLE=false \
-v /data/lib/kafka:/kafka/logs \
-p 9092:9092  \
docker.io/wurstmeister/kafka

################################################################################################################################

#kafka-manager
docker run -d -it -p 9994:9000 --name kafka_manager -e ZK_kafka_onlineS="172.16.50.238:9993" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager

################################################################################################################################

#dev环境zookeeper
docker run -d --network kafka_dev \
-p 9993:2181 \
-v /data/lib/zookeeper/data:/data \
-v /data/lib/zookeeper/datalog:/datalog \
-v /data/log/zookeeper:/logs \
--name zookeeper_dev \
--restart always \
zookeeper

###zoo.cfg###
clientPort=2181
dataDir=/data
dataLogDir=/datalog
tickTime=2000
###zoo.cfg###

#dev环境kafka
docker run --restart always -d \
--name kafka_dev --network kafka_dev \
-e KAFKA_ZOOKEEPER_CONNECT='172.16.50.238:9993' \
-e KAFKA_LISTENERS='PLAINTEXT://0.0.0.0:9992' \
-e KAFKA_BROKER_ID='1' \
-e KAFKA_PORT=9992 \
-e KAFKA_ADVERTISED_LISTENERS='PLAINTEXT://172.16.50.238:9992' \
-e KAFKA_LOG_DIRS=/kafka/logs \
-e KAFKA_AUTO_CREATE_TOPICS_ENABLE=true \
-e KAFKA_LOG_RETENTION_HOURS=72 \
-e KAFKA_OFFSETS_COMMIT_REQUIRED_ACKS=1 \
-e KAFKA_DEFAULT_REPLICATION_FACTOR=1 \
-e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
-e KAFKA_NUM_PARTITIONS=3 \
-v /data/lib/kafka:/kafka/logs \
-p 9992:9992  \
docker.io/wurstmeister/kafka